package com.lanchetech.dao;

import com.lanchetech.bean.dto.AppointmentHourDTO;import com.lanchetech.bean.request.*;import com.lanchetech.bean.response.RushOrderResp;import com.lanchetech.bean.vo.*;import com.lanchetech.entity.OrderSku;
import java.math.BigDecimal;import java.util.Collection;import java.util.Date;import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface OrderSkuMapper {
    int deleteByPrimaryKey(Long id);

    int insert(OrderSku record);

    int insertSelective(OrderSku record);

    OrderSku selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(OrderSku record);

    int updateByPrimaryKey(OrderSku record);

    int updateBatch(List<OrderSku> list);

    int updateBatchSelective(List<OrderSku> list);

    int batchInsert(@Param("list") List<OrderSku> list);

    List<OrderSkuVO> findAllByOrderIds(@Param("orderIds") List<Long> orderIds);

    List<OrderSkuVO> findAllByOrderId(@Param("orderId") Long orderId);

    List<OrderSkuVO> findAllByProductName(PageReq req);

    int updateCommentIdById(@Param("updatedCommentId") Long updatedCommentId, @Param("status") Byte status, @Param("id") Long id);

    int updateAfterSaleIdById(@Param("updatedAfterSaleId") Long updatedAfterSaleId, @Param("id") Long id);

    Integer sumAllForActivity(@Param("activityType") String activityType, @Param("activityId") Long activityId, @Param("spuId") Long spuId,@Param("userId")Long userId);

    int updateStatusByOrderId(@Param("updatedStatus") Byte updatedStatus, @Param("orderId") Long orderId);

    List<Long> findAllBySkuIdAndName(PageReq req);

    int autoUpdateOrderSkuStatus(@Param("updateStatus") Byte updateStatus, @Param("status") Byte status, @Param("timeBefore") Date timeBefore);

    int autoUpdateOrderSkuStatusToComment(@Param("updateStatus") Byte updateStatus, @Param("status") Byte status, @Param("logisticsStatus") Byte logisticsStatus, @Param("timeBefore") Date timeBefore);

    int updateLogisticsStatusByOrderId(@Param("updatedLogisticsStatus") Byte updatedLogisticsStatus, @Param("orderId") Long orderId);

    List<Long> findAllSpuIdByStatusAndLogisticsStatusAndCreatedAt(@Param("status") Byte status, @Param("logisticsStatus") Byte logisticsStatus, @Param("createdAt") Date createdAt);

    Long countPackage(@Param("userId") Long userId, @Param("activityType") String activityType, @Param("activityId") Long activityId);

    int deleteByOrderIdAndStatus(@Param("orderId") Long orderId, @Param("status") Byte status);

    Long countByUserIdAndOrderIdNotDone(@Param("userId") Long userId, @Param("orderId") Long orderId);

    List<OrderSku> findAllByIds(@Param("ids") List<Long> ids);

    List<OrderSku> findAllBySpuIdAndStatusLimit10(@Param("spuId") Long spuId);

    Long countByAppointmentTime(@Param("appointmentTime") Date appointmentTime);

    List<AppointmentHourDTO> countAllByAppointmentTime(PageReq req);

    List<IncomeStatisticVo> getIncomeStatistics(@Param("shopId") Long shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<IncomeStatisticVo> getIncomeStatisticsByType(@Param("date") Date date, @Param("shopId") Long shopId);

    List<OrderStatisticVO> getOrderStatisticsByType(@Param("date") Date date, @Param("shopId") Long shopId, @Param("timeType") Byte timeType);

    Long countByShopIdAndOrderType(@Param("shopId") Long shopId, @Param("orderType") Byte orderType);

    List<StatisticsVO> getSpuAppointmentStatistics(@Param("spuId") Long spuId, @Param("shopId") Long shopId, @Param("time") Date time);

    List<OrderSkuRecommendVO> findAllPage(PageReq req);

    BigDecimal getOrderMoney(PageReq req);

    List<NumberVO> findOrderSkuNumberByIds(@Param("list") List<Long> ordersids);

    List<OrderSku> findAllFirstByordersIds(@Param("list") List<Long> list);

    BigDecimal getTodayAmount(@Param("userId") Long userId, @Param("time") Date time);

    Long getTodayOrderCount(@Param("userId") Long userId, @Param("time") Date time);

    Long getTodayPeopleCount(@Param("userId") Long userId, @Param("time") Date time);

    List<AnchorRankVO> getCarryProductRank();

    int updateStatusAndLogisticsStatusByOrderId(@Param("updatedStatus") Byte updatedStatus, @Param("updatedLogisticsStatus") Byte updatedLogisticsStatus, @Param("orderId") Long orderId);

    Long countByUserIdAndTenantIdAndStatus(@Param("userId") Long userId, @Param("tenantId") Long tenantId);

    BigDecimal sumPageAmount(PageReq req);

    AnchorRankVO sumAnchorCarryAmount(Long id);

    Long getCarryRankNumber(BigDecimal totalCount);

    SpuSellStatisticsVO getSpuSellStatistics(SpuSellStatisticsReq req);

    Long sumCountByTenantId(Long tenantId);

    OrderStatisticAmountVO getShopStatisticsData(TimeRangeReq req);

    Long getUserCount(TimeRangeReq req);

    List<StatisticsVO> getSpuCompleteTrend(@Param("req") TimeRangeReq req, @Param("tenantId") Long shopId);

    List<StatisticsVO> getSpuCustomerTrend(@Param("req") TimeRangeReq req, @Param("tenantId") Long shopId);

    List<SpuSellDataVO> findSpuSellData(SpuSellDataReq req);

    List<StatisticsVO> getOrderSkuByTimeType(@Param("req") TimeTypeReq req);

    BigDecimal sumOrderKindAmount(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("orderKind") Byte orderKind);

    List<OrderSku> findFiveRushBuy(@Param("spuId") Long spuId, @Param("orderKind") Byte orderKind, @Param("rushBuyStatus") Byte rushBuyStatus);

    int updateRushBuyStatusById(@Param("updatedRushBuyStatus") Byte updatedRushBuyStatus, @Param("id") Long id);

    int updateRushBuyStatusAndRushBuyNoById(@Param("updatedRushBuyStatus") Byte updatedRushBuyStatus, @Param("updatedRushBuyNo") String updatedRushBuyNo, @Param("id") Long id);

    int updateRushBuyStatusAndRushBuyNoByIdIn(@Param("updatedRushBuyStatus") Byte updatedRushBuyStatus, @Param("updatedRushBuyNo") String updatedRushBuyNo, @Param("idCollection") Collection<Long> idCollection);

    OrderSku findOneByOrderId(@Param("orderId") Long orderId);

    List<OrderSku> findAllBySpuIdAndRushBuyStatus(@Param("spuId") Long spuId, @Param("rushBuyStatus") Byte rushBuyStatus);

    List<OrderSku> findAllByRushBuyNo(@Param("rushBuyNo") String rushBuyNo);

    List<RushOrderResp> findAllRushPage(RushOrderReq req);

    List<OrderSku> findAllByRushBuyNoInAndRushBuyStatus(@Param("rushBuyNoCollection") Collection<String> rushBuyNoCollection, @Param("rushBuyStatus") Byte rushBuyStatus);

    List<OrderSku> findAllByRushBuyNoIn(@Param("rushBuyNoCollection") Collection<String> rushBuyNoCollection);

    List<OrderSku> findAllBySpuIdInAndRushBuyStatus(@Param("spuIdCollection") Collection<Long> spuIdCollection, @Param("rushBuyStatus") Byte rushBuyStatus);

    Long countByOrderKindAndRushBuyStatusAndUserId(@Param("orderKind") Byte orderKind, @Param("rushBuyStatus") Byte rushBuyStatus, @Param("userId") Long userId);

    List<RushSuccessVO> findRushSuccessLimit10();

    List<RushOrderSkuVO> findRushOrderResultPage(RushOrderReq req);

    OrderSku findOneByUserIdAndSpuId(@Param("userId") Long userId, @Param("spuId") Long spuId);

    Long sumBuyCount(@Param("spuId") Long spuId, @Param("userId") Long userId);

    Long sumBuyCountBySpuId(@Param("spuId") Long spuId,@Param("userId") Long userId);

    List<PartnerStatisticsVO> getPartnerStatistics(@Param("list") List<Long> userIds);

    BossRankingVo findOneBySpuIdAndTenantId(@Param("spuId") Long spuId,@Param("tenantId") Long tenantId);

    List<BossRankingVo> findAllByTenantId(Long tenantId);

    OrderSku findOneById(Long orderSkuId);

    int getOrderSkuByUserId(@Param("userId") Long id,@Param("activity") String activity);
}